package edu.pku.hawk.controller.detectmonitor;

import javax.jms.Message;
import javax.jms.MessageListener;

import edu.pku.hawk.controller.util.Constants;
import edu.pku.hawk.controller.util.MConsumerQueue;
import edu.pku.hawk.controller.util.MQManager;
import edu.pku.hawk.controller.util.MQueue;
import edu.pku.hawk.controller.util.SerResourceList;

public class TestListenner1b {

	public static void main(String[] args) {

		MQManager mgr = null;
		try {
			mgr = new MQManager(Constants.MQServer_Name, Constants.MQServer_Password,
					Constants.MQServer_URL);
			MConsumerQueue queue = mgr.getConsumerQueue(Constants.Ctrl_UI_Sensor_QueueName);
			queue.setMessageListener(new MessageListener() {
				public void onMessage(Message message) {
					try {
						SerResourceList report = (SerResourceList) MQueue.toOjbect(message);
						
					} catch (Exception ex) {
						ex.printStackTrace();
					}

				}
			});

			//mgr.close();
		} catch (Exception ex) {
			ex.printStackTrace();
			if (mgr != null) {
				try {
					mgr.close();
				} catch (Exception eex) {
					ex.printStackTrace();
				}
			}
		}

	}

}
